/**
 * 
 */
package com.angis.fx.db;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

/**
 * @author han
 *
 */
public abstract class ObjectDBHelper {
	
	protected DBHelper dbHelper;
	
	protected SQLiteDatabase readDB;
	
	protected SQLiteDatabase writeDB;
	
	public ObjectDBHelper (Context context){
		dbHelper = new DBHelper(context);
	}
	
	public long insert(String tableName, ContentValues values){
		if (writeDB == null)
			writeDB = dbHelper.getWritableDatabase();
		return writeDB.insert(tableName, null, values);
	}
	
//	public long delete(){
//		if (writeDB == null)
//			writeDB = dbHelper.getWritableDatabase();
//		writeDB.de
//	}
	
	public void closeDB(){
		if (writeDB != null)
			writeDB.close();
		if (readDB != null)
			readDB.close();
	}

}
